#define ENABLE_RA0_PULLUP() _CN2PUE = 1
#define DISABLE_RA0_PULLUP() _CN2PUE = 0
#define ENABLE_RA1_PULLUP() _CN3PUE = 1
#define DISABLE_RA1_PULLUP() _CN3PUE = 0
#define ENABLE_RA2_PULLUP() _CN30PUE = 1
#define DISABLE_RA2_PULLUP() _CN30PUE = 0
#define ENABLE_RA3_PULLUP() _CN29PUE = 1
#define DISABLE_RA3_PULLUP() _CN29PUE = 0
#define ENABLE_RA4_PULLUP() _CN0PUE = 1
#define DISABLE_RA4_PULLUP() _CN0PUE = 0

#define ENABLE_RA6_PULLUP() _CN8PUE = 1
#define DISABLE_RA6_PULLUP() _CN8PUE = 0

#define ENABLE_RB0_PULLUP() _CN4PUE = 1
#define DISABLE_RB0_PULLUP() _CN4PUE = 0
#define ENABLE_RB1_PULLUP() _CN5PUE = 1
#define DISABLE_RB1_PULLUP() _CN5PUE = 0

#define ENABLE_RB2_PULLUP() _CN6PUE = 1
#define DISABLE_RB2_PULLUP() _CN6PUE = 0

#define ENABLE_RB4_PULLUP() _CN1PUE = 1
#define DISABLE_RB4_PULLUP() _CN1PUE = 0
#define ENABLE_RB7_PULLUP() _CN23PUE = 1
#define DISABLE_RB7_PULLUP() _CN23PUE = 0
#define ENABLE_RB8_PULLUP() _CN22PUE = 1
#define DISABLE_RB8_PULLUP() _CN22PUE = 0
#define ENABLE_RB9_PULLUP() _CN21PUE = 1
#define DISABLE_RB9_PULLUP() _CN21PUE = 0

#define ENABLE_RB12_PULLUP() _CN14PUE = 1
#define DISABLE_RB12_PULLUP() _CN14PUE = 0
#define ENABLE_RB13_PULLUP() _CN13PUE = 1
#define DISABLE_RB13_PULLUP() _CN13PUE = 0

#define ENABLE_RB14_PULLUP() _CN12PUE = 1
#define DISABLE_RB14_PULLUP() _CN12PUE = 0
#define ENABLE_RB15_PULLUP() _CN11PUE = 1
#define DISABLE_RB15_PULLUP() _CN11PUE = 0

#define ENABLE_RA0_CN_INTERRUPT() _CN2IE = 1
#define DISABLE_RA0_CN_INTERRUPT() _CN2IE = 0
#define ENABLE_RA1_CN_INTERRUPT() _CN3IE = 1
#define DISABLE_RA1_CN_INTERRUPT() _CN3IE = 0
#define ENABLE_RA2_CN_INTERRUPT() _CN30IE = 1
#define DISABLE_RA2_CN_INTERRUPT() _CN30IE = 0
#define ENABLE_RA3_CN_INTERRUPT() _CN29IE = 1
#define DISABLE_RA3_CN_INTERRUPT() _CN29IE = 0
#define ENABLE_RA4_CN_INTERRUPT() _CN0IE = 1
#define DISABLE_RA4_CN_INTERRUPT() _CN0IE = 0
#define ENABLE_RB0_CN_INTERRUPT() _CN4IE = 1
#define DISABLE_RB0_CN_INTERRUPT() _CN4IE = 0
#define ENABLE_RB1_CN_INTERRUPT() _CN5IE = 1
#define DISABLE_RB1_CN_INTERRUPT() _CN5IE = 0
#define ENABLE_RB4_CN_INTERRUPT() _CN1IE = 1
#define DISABLE_RB4_CN_INTERRUPT() _CN1IE = 0
#define ENABLE_RB7_CN_INTERRUPT() _CN23IE = 1
#define DISABLE_RB7_CN_INTERRUPT() _CN23IE = 0
#define ENABLE_RB8_CN_INTERRUPT() _CN22IE = 1
#define DISABLE_RB8_CN_INTERRUPT() _CN22IE = 0
#define ENABLE_RB9_CN_INTERRUPT() _CN21IE = 1
#define DISABLE_RB9_CN_INTERRUPT() _CN21IE = 0
#define ENABLE_RB14_CN_INTERRUPT() _CN12IE = 1
#define DISABLE_RB14_CN_INTERRUPT() _CN12IE = 0
#define ENABLE_RB15_CN_INTERRUPT() _CN11IE = 1
#define DISABLE_RB15_CN_INTERRUPT() _CN11IE = 0

#define DISABLE_RA0_ANALOG() _PCFG0 = 1
#define ENABLE_RA0_ANALOG() _PCFG0 = 0
#define DISABLE_RA1_ANALOG() _PCFG1 = 1
#define ENABLE_RA1_ANALOG() _PCFG1 = 0
#define DISABLE_RA2_ANALOG() _PCFG4 = 1
#define ENABLE_RA2_ANALOG() _PCFG4 = 0
#define DISABLE_RA3_ANALOG() _PCFG5 = 1
#define ENABLE_RA3_ANALOG() _PCFG5 = 0

#define DISABLE_RB0_ANALOG() _PCFG2 = 1
#define ENABLE_RB0_ANALOG() _PCFG2 = 0
#define DISABLE_RB1_ANALOG() _PCFG3 = 1
#define ENABLE_RB1_ANALOG() _PCFG3 = 0

#define DISABLE_RB12_ANALOG() _PCFG12 = 1
#define ENABLE_RB12_ANALOG() _PCFG12 = 0
#define DISABLE_RB13_ANALOG() _PCFG11 = 1
#define ENABLE_RB13_ANALOG() _PCFG11 = 0

#define DISABLE_RB14_ANALOG() _PCFG10 = 1
#define ENABLE_RB14_ANALOG() _PCFG10 = 0

#define ENABLE_RA0_OPENDRAIN() _ODA0 = 1
#define DISABLE_RA0_OPENDRAIN() _ODA0 = 0
#define ENABLE_RA1_OPENDRAIN() _ODA1 = 1
#define DISABLE_RA1_OPENDRAIN() _ODA1 = 0
#define ENABLE_RA2_OPENDRAIN() _ODA2 = 1
#define DISABLE_RA2_OPENDRAIN() _ODA2 = 0
#define ENABLE_RA3_OPENDRAIN() _ODA3 = 1
#define DISABLE_RA3_OPENDRAIN() _ODA3 = 0
#define ENABLE_RA4_OPENDRAIN() _ODA4 = 1
#define DISABLE_RA4_OPENDRAIN() _ODA4 = 0
#define ENABLE_RA6_OPENDRAIN() _ODA6 = 1
#define DISABLE_RA6_OPENDRAIN() _ODA6 = 0

#define ENABLE_RB0_OPENDRAIN() _ODB0 = 1
#define DISABLE_RB0_OPENDRAIN() _ODB0 = 0
#define ENABLE_RB1_OPENDRAIN() _ODB1 = 1
#define DISABLE_RB1_OPENDRAIN() _ODB1 = 0
#define ENABLE_RB2_OPENDRAIN() _ODB2 = 1
#define DISABLE_RB2_OPENDRAIN() _ODB2 = 0
#define ENABLE_RB4_OPENDRAIN() _ODB4 = 1
#define DISABLE_RB4_OPENDRAIN() _ODB4 = 0
#define ENABLE_RB7_OPENDRAIN() _ODB7 = 1
#define DISABLE_RB7_OPENDRAIN() _ODB7 = 0
#define ENABLE_RB8_OPENDRAIN() _ODB8 = 1
#define DISABLE_RB8_OPENDRAIN() _ODB8 = 0
#define ENABLE_RB9_OPENDRAIN() _ODB9 = 1
#define DISABLE_RB9_OPENDRAIN() _ODB9 = 0
#define ENABLE_RB12_OPENDRAIN() _ODB12 = 1
#define DISABLE_RB12_OPENDRAIN() _ODB12 = 0
#define ENABLE_RB13_OPENDRAIN() _ODB13 = 1
#define DISABLE_RB13_OPENDRAIN() _ODB13 = 0
#define ENABLE_RB14_OPENDRAIN() _ODB14 = 1
#define DISABLE_RB14_OPENDRAIN() _ODB14 = 0
#define ENABLE_RB15_OPENDRAIN() _ODB15 = 1
#define DISABLE_RB15_OPENDRAIN() _ODB15 = 0

static inline void CONFIG_RA0_AS_DIG_OUTPUT(){
 DISABLE_RA0_PULLUP();
 DISABLE_RA0_OPENDRAIN();
 _TRISA0 = 0;
 _PCFG0 = 1;
}
static inline void CONFIG_RA1_AS_DIG_OUTPUT(){
 DISABLE_RA1_PULLUP();
 DISABLE_RA1_OPENDRAIN();
 _TRISA1 = 0;
 _PCFG1 = 1;
}
static inline void CONFIG_RA2_AS_DIG_OUTPUT(){
 DISABLE_RA2_PULLUP();
 DISABLE_RA2_OPENDRAIN();
 _TRISA2 = 0;
 _PCFG4 = 1;
}
static inline void CONFIG_RA3_AS_DIG_OUTPUT(){
 DISABLE_RA3_PULLUP();
 DISABLE_RA3_OPENDRAIN();
 _TRISA3 = 0;
 _PCFG5 = 1;
}
static inline void CONFIG_RA4_AS_DIG_OUTPUT(){
 DISABLE_RA4_PULLUP();
 DISABLE_RA4_OPENDRAIN();
 _TRISA4 = 0;
}
static inline void CONFIG_RA6_AS_DIG_OUTPUT(){
 DISABLE_RA6_PULLUP();
 DISABLE_RA6_OPENDRAIN();
 _TRISA6 = 0;
}static inline void CONFIG_RB0_AS_DIG_OUTPUT(){
 DISABLE_RB0_PULLUP();
 DISABLE_RB0_OPENDRAIN();
 _TRISB0 = 0;
 _PCFG2 = 1;
}
static inline void CONFIG_RB1_AS_DIG_OUTPUT(){
 DISABLE_RB1_PULLUP();
 DISABLE_RB1_OPENDRAIN();
 _TRISB1 = 0;
 _PCFG3 = 1;
}
static inline void CONFIG_RB2_AS_DIG_OUTPUT(){
 DISABLE_RB2_PULLUP();
 DISABLE_RB2_OPENDRAIN();
 _TRISB2 = 0;
 }
static inline void CONFIG_RB4_AS_DIG_OUTPUT(){
 DISABLE_RB4_PULLUP();
 DISABLE_RB4_OPENDRAIN();
 _TRISB4 = 0;
}
static inline void CONFIG_RB7_AS_DIG_OUTPUT(){
 DISABLE_RB7_PULLUP();
 DISABLE_RB7_OPENDRAIN();
 _TRISB7 = 0;
}
static inline void CONFIG_RB8_AS_DIG_OUTPUT(){
 DISABLE_RB8_PULLUP();
 DISABLE_RB8_OPENDRAIN();
 _TRISB8 = 0;
}
static inline void CONFIG_RB9_AS_DIG_OUTPUT(){
 DISABLE_RB9_PULLUP();
 DISABLE_RB9_OPENDRAIN();
 _TRISB9 = 0;
}
static inline void CONFIG_RB12_AS_DIG_OUTPUT(){
 DISABLE_RB12_PULLUP();
 DISABLE_RB12_OPENDRAIN();
 _TRISB12 = 0;
 _PCFG12 = 1;
}
static inline void CONFIG_RB13_AS_DIG_OUTPUT(){
 DISABLE_RB13_PULLUP();
 DISABLE_RB13_OPENDRAIN();
 _TRISB13 = 0;
 _PCFG11 = 1;
}
static inline void CONFIG_RB14_AS_DIG_OUTPUT(){
 DISABLE_RB14_PULLUP();
 DISABLE_RB14_OPENDRAIN();
 _TRISB14 = 0;
 _PCFG10 = 1;
}
static inline void CONFIG_RB15_AS_DIG_OUTPUT(){
 DISABLE_RB15_PULLUP();
 DISABLE_RB15_OPENDRAIN();
 _TRISB15 = 0;
}
static inline void CONFIG_RA0_AS_DIG_OD_OUTPUT(){
 DISABLE_RA0_PULLUP();
 ENABLE_RA0_OPENDRAIN();
 _TRISA0 = 0;
 _PCFG0 = 1;
}
static inline void CONFIG_RA1_AS_DIG_OD_OUTPUT(){
 DISABLE_RA1_PULLUP();
 ENABLE_RA1_OPENDRAIN();
 _TRISA1 = 0;
 _PCFG1 = 1;
}
static inline void CONFIG_RA2_AS_DIG_OD_OUTPUT(){
 DISABLE_RA2_PULLUP();
 ENABLE_RA2_OPENDRAIN();
 _TRISA2 = 0;
 _PCFG4 = 1;
}
static inline void CONFIG_RA3_AS_DIG_OD_OUTPUT(){
 DISABLE_RA3_PULLUP();
 ENABLE_RA3_OPENDRAIN();
 _TRISA3 = 0;
 _PCFG5 = 1;
}
static inline void CONFIG_RA4_AS_DIG_OD_OUTPUT(){
 DISABLE_RA4_PULLUP();
 ENABLE_RA4_OPENDRAIN();
 _TRISA4 = 0;
}
static inline void CONFIG_RA6_AS_DIG_OD_OUTPUT(){
 DISABLE_RA6_PULLUP();
 ENABLE_RA6_OPENDRAIN();
 _TRISA6 = 0;
}
static inline void CONFIG_RB0_AS_DIG_OD_OUTPUT(){
 DISABLE_RB0_PULLUP();
 ENABLE_RB0_OPENDRAIN();
 _TRISB0 = 0;
 _PCFG2 = 1;
}
static inline void CONFIG_RB1_AS_DIG_OD_OUTPUT(){
 DISABLE_RB1_PULLUP();
 ENABLE_RB1_OPENDRAIN();
 _TRISB1 = 0;
 _PCFG3 = 1;
}
static inline void CONFIG_RB4_AS_DIG_OD_OUTPUT(){
 DISABLE_RB4_PULLUP();
 ENABLE_RB4_OPENDRAIN();
 _TRISB4 = 0;
}
static inline void CONFIG_RB7_AS_DIG_OD_OUTPUT(){
 DISABLE_RB7_PULLUP();
 ENABLE_RB7_OPENDRAIN();
 _TRISB7 = 0;
}
static inline void CONFIG_RB8_AS_DIG_OD_OUTPUT(){
 DISABLE_RB8_PULLUP();
 ENABLE_RB8_OPENDRAIN();
 _TRISB8 = 0;
}
static inline void CONFIG_RB9_AS_DIG_OD_OUTPUT(){
 DISABLE_RB9_PULLUP();
 ENABLE_RB9_OPENDRAIN();
 _TRISB9 = 0;
}
static inline void CONFIG_RB12_AS_DIG_OD_OUTPUT(){
 DISABLE_RB12_PULLUP();
 ENABLE_RB12_OPENDRAIN();
 _TRISB12 = 0;
 _PCFG12 = 1;
}
static inline void CONFIG_RB13_AS_DIG_OD_OUTPUT(){
 DISABLE_RB13_PULLUP();
 ENABLE_RB13_OPENDRAIN();
 _TRISB13 = 0;
 _PCFG11 = 1;
}
static inline void CONFIG_RB14_AS_DIG_OD_OUTPUT(){
 DISABLE_RB14_PULLUP();
 ENABLE_RB14_OPENDRAIN();
 _TRISB14 = 0;
 _PCFG10 = 1;
}
static inline void CONFIG_RB15_AS_DIG_OD_OUTPUT(){
 DISABLE_RB15_PULLUP();
 ENABLE_RB15_OPENDRAIN();
 _TRISB15 = 0;
}
static inline void CONFIG_RA0_AS_DIG_INPUT(){
 DISABLE_RA0_PULLUP();
 _TRISA0 = 1;
 _PCFG0 = 1;
}
static inline void CONFIG_RA1_AS_DIG_INPUT(){
 DISABLE_RA1_PULLUP();
 _TRISA1 = 1;
 _PCFG1 = 1;
}
static inline void CONFIG_RA2_AS_DIG_INPUT(){
 DISABLE_RA2_PULLUP();
 _TRISA2 = 1;
 _PCFG4 = 1;
}
static inline void CONFIG_RA3_AS_DIG_INPUT(){
 DISABLE_RA3_PULLUP();
 _TRISA3 = 1;
 _PCFG5 = 1;
}
static inline void CONFIG_RA4_AS_DIG_INPUT(){
 DISABLE_RA4_PULLUP();
 _TRISA4 = 1;
}
static inline void CONFIG_RA6_AS_DIG_INPUT(){
 DISABLE_RA6_PULLUP();
 _TRISA6 = 1;
}
static inline void CONFIG_RB0_AS_DIG_INPUT(){
 DISABLE_RB0_PULLUP();
 _TRISB0 = 1;
 _PCFG2 = 1;
}
static inline void CONFIG_RB1_AS_DIG_INPUT(){
 DISABLE_RB1_PULLUP();
 _TRISB1 = 1;
 _PCFG3 = 1;
}
static inline void CONFIG_RB2_AS_DIG_INPUT(){
 DISABLE_RB2_PULLUP();
 _TRISB2 = 1;
}
static inline void CONFIG_RB4_AS_DIG_INPUT(){
 DISABLE_RB4_PULLUP();
 _TRISB4 = 1;
}
static inline void CONFIG_RB7_AS_DIG_INPUT(){
 DISABLE_RB7_PULLUP();
 _TRISB7 = 1;
}
static inline void CONFIG_RB8_AS_DIG_INPUT(){
 DISABLE_RB8_PULLUP();
 _TRISB8 = 1;
}
static inline void CONFIG_RB9_AS_DIG_INPUT(){
 DISABLE_RB9_PULLUP();
 _TRISB9 = 1;
}
static inline void CONFIG_RB12_AS_DIG_INPUT(){
 DISABLE_RB12_PULLUP();
 _TRISB12 = 1;
 _PCFG12 = 1;
}
static inline void CONFIG_RB13_AS_DIG_INPUT(){
 DISABLE_RB13_PULLUP();
 _TRISB13 = 1;
 _PCFG11 = 1;
}
static inline void CONFIG_RB14_AS_DIG_INPUT(){
 DISABLE_RB14_PULLUP();
 _TRISB14 = 1;
 _PCFG10 = 1;
}
static inline void CONFIG_RB15_AS_DIG_INPUT(){
 DISABLE_RB15_PULLUP();
 _TRISB15 = 1;
}


#ifdef _PCFG0
static inline void CONFIG_AN0_AS_ANALOG(){
  CONFIG_RA0_AS_DIG_INPUT();
  _PCFG0 = 0;
}
#endif
#ifdef _PCFG1
static inline void CONFIG_AN1_AS_ANALOG(){
  CONFIG_RA1_AS_DIG_INPUT();
  _PCFG1 = 0;
}
#endif
#ifdef _PCFG2
static inline void CONFIG_AN2_AS_ANALOG(){
  CONFIG_RB0_AS_DIG_INPUT();
  _PCFG2 = 0;
}
#endif
#ifdef _PCFG3
static inline void CONFIG_AN3_AS_ANALOG(){
  CONFIG_RB1_AS_DIG_INPUT();
  _PCFG3 = 0;
}
#endif
#ifdef _PCFG4
static inline void CONFIG_AN4_AS_ANALOG(){
  CONFIG_RA2_AS_DIG_INPUT();
  _PCFG4 = 0;
}
#endif
#ifdef _PCFG5
static inline void CONFIG_AN5_AS_ANALOG(){
  CONFIG_RA3_AS_DIG_INPUT();
  _PCFG5 = 0;
}
#endif
#ifdef _PCFG10
static inline void CONFIG_AN10_AS_ANALOG(){
  CONFIG_RB14_AS_DIG_INPUT();
  _PCFG10 = 0;
}
#endif
#ifdef _PCFG11
static inline void CONFIG_AN11_AS_ANALOG(){
  CONFIG_RB13_AS_DIG_INPUT();
  _PCFG11 = 0;
}
#endif

#define _PIC24_DIGIO_DEFINED
